<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myMessageLabel" jhiTranslate="notebookWxappApp.message.home.createOrEditLabel">Create or edit a Message</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!message.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="message.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="notebookWxappApp.message.content" for="field_content">Content</label>
            <input type="text" class="form-control" name="content" id="field_content"
                [(ngModel)]="message.content" maxlength="1000"/>
            <div [hidden]="!(editForm.controls.content?.dirty && editForm.controls.content?.invalid)">
                <small class="form-text text-danger"
                   [hidden]="!editForm.controls.content?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" translateValues="{ max: 1000 }">
                   This field cannot be longer than 1000 characters.
                </small>
            </div>
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="notebookWxappApp.message.address" for="field_address">Address</label>
            <input type="text" class="form-control" name="address" id="field_address"
                [(ngModel)]="message.address" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="notebookWxappApp.message.open" for="field_open">Open</label>
            <input type="checkbox" class="form-control" name="open" id="field_open"
                [(ngModel)]="message.open" />
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="notebookWxappApp.message.user" for="field_user">User</label>
            <select class="form-control" id="field_user" name="user" [(ngModel)]="message.userId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="wxUserOption.id" *ngFor="let wxUserOption of wxusers; trackBy: trackWxUserById">{{wxUserOption.id}}</option>
            </select>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
